package com.example.demo.util;

public class JsonData {
    private static final String SUCCESS_MSG="SUCCESS";
    private static final String FAILED_MSG="FAILED";
    /**
     * 状态码
     * */
    private String result;
    /**
     * 返回信息
     * */
    private String message;
    /**
     * 返回数据
     * */
    private Object data;

    public JsonData(String result, String message, Object data) {
        this.result = result;
        this.message = message;
        this.data = data;
    }

    public JsonData(String result, String message) {
        this.result = result;
        this.message = message;
    }



    public static JsonData buildSuccess(Object data){
        return new JsonData(SUCCESS_MSG,"操作成功",data);
    }

    public static JsonData buildError(String msg){
        return new JsonData(FAILED_MSG,msg);
    }

    public String getResult() {
        return result;
    }

    public JsonData() {
    }

    public void setResult(String result) {
        this.result = result;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }
}